package com.power.leopard.remote;

public class ServiceParam {

	private String[] paramNames;

	private int hashCode = 0;

	public ServiceParam(String[] paramNames) {
		this.paramNames = paramNames;

		StringBuilder sb = new StringBuilder();
		for (String paramName : paramNames) {
			sb.append(paramName).append("@");
		}
		this.hashCode = sb.toString().hashCode();
	}

	public int getLength() {
		return paramNames.length;
	}

	public String[] getParamNames() {
		return paramNames;
	}

	public void setParamNames(String[] paramNames) {
		this.paramNames = paramNames;
	}

	@Override
	public int hashCode() {
		return hashCode;
	}
	
	@Override
	public boolean equals(Object obj) {
		if(this == obj) {
			return true;
		}
		
		if(obj instanceof ServiceParam) {
			return obj.hashCode() == this.hashCode();
		}
		return false;
	}
}
